package com.eb.controller;

import com.eb.dto.AnnouncementPageQueryDTO;
import com.eb.result.PageResult;
import com.eb.result.Result;
import com.eb.service.AnnouncementService;
import com.eb.service.impl.AnnouncementServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/announcement")
@Api(tags = "通知接口")
@Slf4j
@CrossOrigin
public class AnnouncementController {
    @Autowired
    AnnouncementService announcementService = new AnnouncementServiceImpl();
    /**
     * 分页查询通知
     * @param announcementPageQueryDTO
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("分页查询通知")
    public Result<PageResult> page(AnnouncementPageQueryDTO announcementPageQueryDTO){
        log.info("分页查询通知: {}", announcementPageQueryDTO);
        PageResult pageResult = announcementService.pageQuery(announcementPageQueryDTO);
        return Result.success(pageResult);
    }
}
